from django.http import HttpResponse,HttpResponseRedirect
#导入模板解析库
from django.shortcuts import render
#导入时间模块
import datetime

#定义视图方法
def page_not_found(request,**kwargs):
    #解析404模板
    return render(request,"d2_404.html")
    return HttpResponse("您这个页面找不到")

#定义首页方法
def index(request):
    #调用render方法来解析模板，第一个参数是request，第二个参数是模板文件名
    #定义变量，输出模板
    test_str = "MAIMI"
    test_int = 9107
    test_list = ["大G","凯迪拉克","霸道"]
    test_dict = [{"name":"贾还虎","age":20},{"name":"锅锅","age":20}]
    content = "Hello , I am MAIMI "
    dt = datetime.datetime.now()
    return render(request,'d2_index.html',{'test_str':test_str,'test_int':test_int,'test_list':test_list,"test_dict":test_dict,'content':content,'dt':dt})
